package com.skb.core.service;

import com.skb.core.dao.SegmentDao;
import com.skb.core.model.Segment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

@Service("segmentService")
public class SegmentService implements ISegmentService {

    @Autowired
    private SegmentDao segmentDao;

    @Override
    public Segment create(Segment segment) {
        return segmentDao.create(segment);
    }

    @Override
    public Segment get(Serializable id) {
        return segmentDao.get(id);
    }

    @Override
    public Segment update(Segment segment) {
        return segmentDao.update(segment);
    }

    @Override
    public void delete(Segment segment) {
        segmentDao.delete(segment);
    }

    @Transactional(readOnly = true)
    @Override
    public List<Segment> findAll() {
        return segmentDao.findAll();
    }
}
